package com.qidian.by.goods.controller;

import com.qidian.by.goods.service.IItemSpecificationService;
import com.qidian.by.goods.vo.ItemAndSpeRelationVO;
import com.qidian.by.pojo.goods.entity.ItemSpecification;
import com.qidian.by.util.pojo.EsResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 小可怎么都睡不够
 * @since 2024-05-08
 */
@RestController
@RequestMapping("/spe")
public class ItemSpecificationController {
    @Autowired
    private IItemSpecificationService speService;

    @PostMapping("/save")
    public EsResult save(@RequestBody ItemSpecification spe){
            return speService.save(spe);
    };
    @GetMapping("/list")
    public EsResult list(ItemSpecification spe,@RequestParam(defaultValue = "1")int page,@RequestParam(defaultValue = "10")int limit){
        return speService.list(spe,page,limit);
    }
    @PostMapping("/replace")
    public EsResult replace(@RequestBody ItemAndSpeRelationVO vo){
//        拿到的是最新的规格数据
        return speService.replace(vo);
    }
}
